package responsibility.filter;

import responsibility.chain.FilterChain;
import responsibility.http.Request;
import responsibility.http.Respones;


public class AddressFilter extends HttpRequestAndResponesFilter {



    @Override
    void doRequest(Request request) {
        System.out.println("  AddressFilter.doRequest() ");
        String ip = request.getIp();
        if (ip.equals("192.168.1.123")){
            request.setMessage(request.getMessage()+"   非法 ip  地址  ");
        }

    }

    @Override
    void doRespones(Respones response) {
        System.out.println("  AddressFilter.doRespones() ");
        if (response.getIp().equals("8080")){
            response.setMessage("  非法 port ");
        }

    }
}
